package com.yj.service;

import com.yj.anno.RpcService;
import com.yj.interfaces.IUserService;
import com.yj.pojo.User;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.Map;

@RpcService
@Service
public class IUserServiceImpl implements IUserService {

    static Map<Integer, User> USER_MAP = new HashMap<>();

    static {
        USER_MAP.put(1, new User( "Tom", 1, "123@qq.com"));
        USER_MAP.put(2, new User( "Jerry", 2, "456@163.com"));
        USER_MAP.put(3, new User( "Mike", 3,"789@163.com"));
    }


    @Override
    public User getUserById(Integer id) {
        User user = USER_MAP.get(id);
        if (user != null) {
            return user;
        }
        return null;
    }
}
